﻿#ifndef HNRJITPROGRESS_H
#define HNRJITPROGRESS_H

#include "HnrjitControl.h"

struct SplitSizes
{
	WORD wLeftSize; // 左边图片大小
	WORD wFullSize; // 满的图片大小
	WORD wSliderSize; // 滑块图片大小
	WORD wEmptySize; // 空的图片大小
	WORD wRightSize; // 右边图片大小
};

class DIRECTUI_API CHnrjitProgress : public CHnrjitControl
{
public:
	explicit CHnrjitProgress();

	/// <summary>获取当前类标识</summary>
	virtual DWORD GetClsid() const { return CLSID_HNRJITPROGRESS; }

	/// <summary>设置属性值</summary>
	/// <param name="pxElement">XML元素</param>
	virtual void SetAttribute(const TiXmlElement* pxElement, HZIP hZipRes = NULL);

public:
	/// <summary>获取或设置进度条最大值</summary>
	LONG GetMaximum() const;
	bool SetMaximum(LONG lMaximum);

	/// <summary>获取或设置进度条最小值</summary>
	LONG GetMinimum() const;
	bool SetMinimum(LONG lMinimum);

	/// <summary>获取或设置进度条数值</summary>
	LONG GetValue() const;
	void SetValue(LONG lValue);

	/// <summary>获取或设置图片分离大小集</summary>
	const SplitSizes& GetSplitSizes() const;
	void SetSplitSizes(const SplitSizes& tSplitSizes);

	/// <summary>获取或设置是否显示百分比</summary>
	BOOL IsShowPercent() const;
	void SetShowPercent(BOOL isShowPercent);

protected:
	/// <summary>绘制文本</summary>
	/// <param name="pDC">设备上下文</param>
	/// <param name="rcGeometry">要渲染区域</param>
	/// <param name="iControlStatus">控件状态</param>
	virtual void DrawTitle(HDC hdc, const CRect& rcGeometry, ControlStatus iControlStatus);

	/// <summary>绘制矩形</summary>
	/// <param name="pDC">设备上下文</param>
	/// <param name="rcGeometry">要渲染区域</param>
	/// <param name="iControlStatus">控件状态</param>
	virtual void DrawRect(HDC hdc, const CRect& rcGeometry, ControlStatus iControlStatus);

	/// <summary>绘制图片</summary>
	/// <param name="pDC">设备上下文</param>
	/// <param name="rcGeometry">要渲染区域</param>
	/// <param name="iControlStatus">控件状态</param>
	virtual void DrawImage(HDC hdc, const CRect& rcGeometry, ControlStatus iControlStatus);

public:
	/// <summary>绘制进度条</summary>
	/// <param name="pDC">设备上下文</param>
	virtual void DrawControl(HDC hdc);

private:
	LONG m_lMaximum; // 进度条最大值
	LONG m_lMinimum; // 进度条最小值
	LONG m_lValue; // 进度条数值

	SplitSizes m_tSplitSizes; // 五张图片原始大小

	BOOL m_isShowPercent; // 是否显示百分比
};

#endif // HNRJITPROGRESS_H